<template>
  <header class="header">
    <nav class="nav">
      <n-flex justify="space-between" class="nav2">
        <div>
          <button>主页</button>
        </div>
        <div @click="handlemessage">
          <button>个人中心</button>
        </div>
        <div>
          <button>历史记录</button>
        </div>
      </n-flex>
      <button class="nav-button" @click="handleregister">注册</button>
      <button class="nav-button" @click="handlelogin" style="margin-left: 15px;">登录</button>
    </nav>
  </header>
  <div>
    <!-- <h1>图片识别</h1> -->
  </div>
  <br>
  <div class="form">
    <div class="img">
      <h1>图像识别</h1>
    </div>
    <div class="result">
      <h1>识别结果</h1>
    </div>

  </div>
</template>

<style>
body {
  background-image: url("./images/网页背景图.jpg");
  /*background-size: 100%;*/
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-attachment: fixed;
  color: rgba(255, 255, 255, 0.8);
  /* font-size: 14px; */
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.header {
  width: 100%;
  background-color: rgba(255, 255, 255, 0.5);
  /* 设置背景颜色并添加透明度 */
  backdrop-filter: blur(1px);
  /* 添加模糊效果 */
  padding: 10px 0;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  /* font-size: 34px; */

}

.nav2 button {
  background-color: rgba(0, 0, 0, 0);
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: medium;
  transition: transform 0.3s ease;
}

.nav2 button:hover {
  transform: scale(1.1);
}

.nav {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding-right: 30px;
}

.nav-button {
  background-color: rgba(253, 253, 252, 0.16);
  color: rgba(255, 255, 255, 0.8);
  border: none;
  padding: 10px 20px;
  margin-left: 10px;
  cursor: pointer;
  transition: transform 0.3s ease;
  font-size: 15px;
  border-radius: 7px;

}

.nav-button:hover {
  transform: scale(1.2);
}

h4 {
  color: black;
}

.form {
  width: 30%;
  height: 70%;
  position: absolute;
  top: 55%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(255, 255, 255, 0.15);
  /*border: 1px solid #ccc;*/
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
}

.result {
  margin-top: 50%;
  border-top: 1px dashed white;
}
</style>

<script lang="ts" setup>
//封装跳转函数
import { useRouter } from 'vue-router';
import { nav } from '../router/window'
import { NFlex } from 'naive-ui'
const router = useRouter()

function handleregister() {
  nav(router, '/register')
}

function handlelogin() {
  nav(router, '/loginer')
}
function handlemessage() {
  nav(router, '/messager')
}
</script>